package com.edu.eduservice.controller.front;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.edu.common.utils.R;
import com.edu.eduservice.entity.EduTeacher;
import com.edu.eduservice.service.EduTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Api(description = "分页讲师列表")
@RestController
@RequestMapping("/eduservice/bannerfront")
@CrossOrigin
public class TeacherController {
    @Autowired
    private EduTeacherService eduTeacherService;

    /**
     * 分页查询讲师
     * @param page
     * @param limit
     * @return
     */
    @PostMapping("/list/{page}/{limit}")
    public R teacherPageList(@ApiParam(name = "page", value = "当前页码", required = true)
                             @PathVariable Long page ,
                                @ApiParam(name = "limit", value = "每页记录数", required = true)
                               @PathVariable Long limit ){
        Page<EduTeacher> eduTeacherPage = new Page<>(page, limit);

       Map<String,Object> map= eduTeacherService.pageListWeb(eduTeacherPage);

       return R.ok().data(map);

    }

}
